<?php

namespace App\Http\Controllers;

use Dingo\Api\Routing\Helpers;
use Illuminate\Contracts\Auth\Factory;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\StatefulGuard;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Laravel\Lumen\Application;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests, Helpers;

    /**
     * 获取 auth 实例
     *
     * @return Factory|Guard|StatefulGuard|\Illuminate\Contracts\Foundation\Application|Application
     */
    public function adminUser()
    {
        return auth('api');
    }

    /**
     * 获取分页数量
     *
     * @return mixed
     */
    public function pageLimit()
    {
        return request()->input('pageSize',15);
    }

    /**
     * git 统计
     *
     * 统计个人  git log --author="vagrant" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 + $2 } END { printf "增加的行数: %s, 删除的行数: %s, 总行数: %s\n", add, subs, loc }

     *
     * 统计所有  git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 + $2 } END { printf "增加的行数: %s, 删除的行数: %s, 总行数: %s\n", add, subs, loc }' -; done
     */
}
